/*
 * cFolder.cpp
 *
 *  Created on: 2018年4月26日
 *      Author: Kwolve
 */

#include "cFolder.h"
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>


cFolder::cFolder() {
	// TODO 自动生成的构造函数存根

}

cFolder::~cFolder() {
	// TODO 自动生成的析构函数存根
}

std::vector<std::string> cFolder::scanList(std::string path)
{
    DIR *d;
    struct dirent *file;
    struct stat sb;
    m_List.clear();
    if(!(d = opendir(path.c_str())))
    {
        printf("error opendir %s!!!\n",path.c_str());
        return m_List;
    }
    while((file = readdir(d)) != NULL)
    {
        if(strncmp(file->d_name, ".", 1) == 0)
            continue;

          if (strstr(file->d_name, ".txt") != NULL) {
        	  std::string path1 = path+"/";
              m_List.push_back(path1 + file->d_name);
              printf("opendir %s!!!\n",file->d_name);
          }
    }
    closedir(d);
    return m_List;
}
